package com.cn.wanxi.service;

import com.cn.wanxi.dao.NewsDao;
import com.cn.wanxi.model.NewsModel;

public class NewsService {

    /**
     * main主页面foot栏获取新闻信息
     * @return
     */
    public NewsModel[] getNewsModelsForMain() {
        NewsDao newsDao = new NewsDao();
        NewsModel[] newsModels = new NewsModel[3];
        for (int i = 0; i < newsModels.length; i++) {
            NewsModel model = new NewsModel();
            model.setContent(newsDao.content[i]);
            model.setTime(newsDao.time[i]);
            newsModels[i] = model;
            System.out.println(newsModels);
        }
        return newsModels;
    }


    /**
     * 新闻页面
     * @return
     */
    public NewsModel[] getNewsModels() {
        NewsDao newsDao = new NewsDao();
        NewsModel[] newsModels = new NewsModel[8];
        for (int i = 0; i < newsModels.length; i++) {
            NewsModel model = new NewsModel();
            model.setContent(newsDao.content[i]);
            model.setTime(newsDao.time[i]);
            newsModels[i] = model;
        }
        return newsModels;
    }
}
